package com.ymatou.iapi.godmch.testcase;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.dguser.parameter.UserCreateBean;
import com.ymatou.iapi.godmch.parameter.checkcurrencymchBean;
import com.ymatou.iapi.godmch.parameter.CreateCodeBean;
import com.ymatou.iapi.godmch.parameter.createmchBean;
import com.ymatou.iapi.godmch.service.checkcurrencymchCall;
import com.ymatou.iapi.godmch.service.CreateCodeCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.DGUserCallService;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.database.model.invite_code;
import com.ymttest.database.sqlwapper.godmch.invite_codeWapper;
/**
*校验商户与邀请码商户结算币种是否一致
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_checkcurrencymch{
	private static checkcurrencymchBean bean;
	private static checkcurrencymchCall call;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("校验商户与邀请码商户结算币种是否一致");
	}

	@Before
	public void caseUp() {
		bean=new checkcurrencymchBean();
		call=new checkcurrencymchCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(call.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_checkcurrencymch_001() {
		Logger.start(true,"校验商户与邀请码商户结算币种是否一致-永久邀请码-一致-返回成功");
		try {
			//渠道用户
			UserCreateBean usercreateBean2 = DGUserCallService.initSellerUsercreateBean();
			int mchId = DGUserCallService.UserCreateCall(usercreateBean2);
			//创建渠道1邀请码
			CreateCodeBean codebean=GodmchManageCallService.CreateAllMsgSellerMch();
			codebean.setIsPermanently(true);
			CreateCodeCall codeCall=GodmchManageCallService.createCodeCall(codebean);
			//创建渠道2
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId);
			GodmchManageCallService.createmchCallForChannel(createBean1);
	        
            bean.setMchId(mchId);
            bean.setCode(codeCall.getCode());
			call.setData(bean);
			call.callService();	

			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getMatch(), "验证返回成功match值");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_checkcurrencymch_002() {
		Logger.start(true,"校验商户与邀请码商户结算币种是否一致-永久邀请码-不一致-返回失败(现在返回成功 20191023修改)");
		try {
			//渠道用户
			UserCreateBean usercreateBean2 = DGUserCallService.initSellerUsercreateBean();
			int mchId = DGUserCallService.UserCreateCall(usercreateBean2);
			//创建渠道1邀请码
			CreateCodeBean codebean=GodmchManageCallService.CreateAllMsgSellerMch();
			codebean.setIsPermanently(true);
			CreateCodeCall codeCall=GodmchManageCallService.createCodeCall(codebean);
			//创建渠道2
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId);
			createBean1.setCountry("JPN");
			GodmchManageCallService.createmchCallForChannel(createBean1);
			
            bean.setMchId(mchId);
            bean.setCode(codeCall.getCode());
			call.setData(bean);
			call.callService();	
			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getMatch(), "验证返回成功match值");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_checkcurrencymch_003() {
		Logger.start(true,"校验商户与邀请码商户结算币种是否一致-非永久邀请码-一致-返回成功");
		try {
			//渠道用户
			UserCreateBean usercreateBean2 = DGUserCallService.initSellerUsercreateBean();
			int mchId = DGUserCallService.UserCreateCall(usercreateBean2);
			//创建渠道1邀请码
			CreateCodeBean codebean=GodmchManageCallService.CreateAllMsgSellerMch();
			codebean.setIsPermanently(false);
			CreateCodeCall codeCall=GodmchManageCallService.createCodeCall(codebean);
			//创建渠道2
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId);
			GodmchManageCallService.createmchCallForChannel(createBean1);
	        
            bean.setMchId(mchId);
            bean.setCode(codeCall.getCode());
			call.setData(bean);
			call.callService();	

			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getMatch(), "验证返回成功match值");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_checkcurrencymch_004() {
		Logger.start(true,"校验商户与邀请码商户结算币种是否一致-非永久邀请码-不一致-返回失败(现在返回成功 跨国20191023修改)");
		try {
			//渠道用户
			UserCreateBean usercreateBean2 = DGUserCallService.initSellerUsercreateBean();
			int mchId = DGUserCallService.UserCreateCall(usercreateBean2);
			//创建渠道1邀请码
			CreateCodeBean codebean=GodmchManageCallService.CreateAllMsgSellerMch();
			codebean.setIsPermanently(false);
			CreateCodeCall codeCall=GodmchManageCallService.createCodeCall(codebean);
			//创建渠道2
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId);
			createBean1.setCountry("JPN");
			GodmchManageCallService.createmchCallForChannel(createBean1);
			
            bean.setMchId(mchId);
            bean.setCode(codeCall.getCode());
			call.setData(bean);
			call.callService();	
			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getMatch(), "验证返回成功match值");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_checkcurrencymch_005() {
		Logger.start(true,"校验商户与邀请码商户结算币种是否一致-非永久邀请码-不一致-返回失败(现在返回成功 跨国20191023修改)");
		try {
			//渠道用户
			UserCreateBean usercreateBean2 = DGUserCallService.initSellerUsercreateBean();
			//usercreateBean2.setCountryCode("JPN");
			int mchId = DGUserCallService.UserCreateCall(usercreateBean2);
			//创建渠道1邀请码
			CreateCodeBean codebean=GodmchManageCallService.CreateAllMsgSellerMch();
			codebean.setIsPermanently(false);
			CreateCodeCall codeCall=GodmchManageCallService.createCodeCall(codebean);
			//创建渠道2
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId);
			createBean1.setCountry("JPN");
			GodmchManageCallService.createmchCallForChannel(createBean1);
			
            bean.setMchId(mchId);
            bean.setCode(codeCall.getCode());
			call.setData(bean);
			call.callService();	
//			//验证点
//	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
//	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
//	        Logger.verifyEquals(true, call.getMatch(), "验证返回成功match值");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}